package com.dq.security.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dongqun
 * @Description:
 * @date 2019/1/5 20:32
 */
@Controller
public class TestController {

    @RequestMapping("/")
    public String root () {
        return "redirect:/index";
    }

    @RequestMapping("/index")
        public String index(){
            return "index";
        }

    @RequestMapping("user/index")
    public String userindex () {
        return "user/index";
    }

    @RequestMapping("/login")
        public String login(){
        return "login";
    }

    @RequestMapping ("/login-error")
    public String loginError(Model model){
        model.addAttribute("loginError", "用户名或密码错误") ;
        return "login";
    }

    @GetMapping("/401")
    public String accesssDenied () {
        return "401";
    }
}




           






             

